<template>
  <div>
    <li v-for="item in productInfo" :key="item.id">
      <router-link tag="div" :to="'/detail/' + item.productId" class="img-wrapper-product">
        <img :src="item.productImage" alt="" width="100%">
      </router-link>
      <p class="title">{{item.productName}}</p>
      <p class="classify">{{item.classifyName}}</p>
      <p class="bazaar-price">市场价: {{item.bazaarPrice}}</p>
      <p class="price">价格: {{item.salePrice}}</p>
      <span
        style="float: right; font-size: 12px; padding: 5px; border: 1px solid #ccc; color: #ccc; margin-bottom: 10px; cursor: pointer;"
        v-if="deleteGoods"
        @click="deleteProduct(item._id)"
      >删除</span>
    </li>
  </div>
</template>

<script>
export default {
  props: {
    // eslint-disable-next-line vue/no-dupe-keys
    productInfo: {
      type: Array,
      // eslint-disable-next-line vue/require-valid-default-prop
      default: {}
    },
    deleteGoods: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    deleteProduct (productId) {
      this.$emit('deleteProduct', productId)
    }
  }
}
</script>

<style lang="scss" scoped>
li {
  width: 230px;
  height: 254px;
  display: inline-block;
  // background-color: red;
  border: 1px solid #ccc;
  margin-right: 10px;
  margin-bottom: 10px;
  line-height: 15px;
  .img-wrapper-product {
    width: 210px;
    height: 170px;
    overflow: hidden;
    margin: 10px;
    margin-bottom: 0px;
  }
  .title {
    font-size: 12px;
    color:#8f6228;
    font-weight: bold !important;
    margin-left: 15px;
  }
  .classify {
    font-size: 12px;
    color: #ffd676;
    margin-left: 15px;
    cursor: pointer;
  }
  .classify:hover {
    color: #2c90ff;
  }
  .bazaar-price {
    font-size: 12px;
    color: #bfa27b;
    margin-left: 15px;
    text-decoration:line-through;
  }
  .price {
    font-size: 12px;
    color: #ff3c00;
    margin-left: 15px;
  }
}
li:hover {
  border: 1px solid #ffd676;
}
</style>
